// 包装组件 i-checkbox
import { extractModel } from '@/utils/tools'


export default {
    name:'c-i-checkbox',
    functional: true,

    render (h, context){
        let { value, callback, conf } = extractModel(context)

       
        let {

            size,
            disabled,
            indeterminate,
            trueValue,
            falseValue,

            //包裹子项
            _child,
            onChange,
            
        } = conf;

        // 包装回调
        function change (args){
            
            if(onChange){
                onChange(args)
            }
            
            callback(args)
        }

        
        return (

            <checkbox value={!!value} onInput={change} size={size||'small'} disabled={disabled}>
                {_child}                
            </checkbox>
        )
        
    }

}